--[[----------------------------------------------------------------------------
LR2ConfigSection.lua
--------------------------------------------------------------------------------
Copyright 2010 Andriy Doroshchuk
 All Rights Reserved.
------------------------------------------------------------------------------]]

-- Lightroom SDK
local LrView 		= import 'LrView'
local LrPathUtils 	= import 'LrPathUtils'
local LrDialogs		= import 'LrDialogs'

--============================================================================--
local LR2ConfigSection = {}
-------------------------------------------------------------------------------
LR2ConfigSection.exportPresetFields = {
	{ key = 'pathToIM',	default = ''},
}
-------------------------------------------------------------------------------
function LR2ConfigSection.sectionForFilterInDialog( viewFactory, propertyTable )
	local vf = viewFactory
	local pt = propertyTable
	
	local ef = vf:edit_field {
		width 		= 250,
		value 		= LrView.bind 'pathToIM',
	} 

	return {
		title 		= LOC '$$$/LR2/PhotoFrames/Config/SectionTitle=LR2/PhotoFrames Configuration',
		synopsis	= LrView.bind {key = 'pathToIM', object = propertyTable },
		
		vf:row{
			spacing = vf:control_spacing(),
			vf:static_text {
				title 		= LOC '$$$/LR2/PhotoFrames/Config/PathToImageMagick=Path to ImageMagick application:',
				alignment 	= 'right',
				width 		= LrView.share 'label_width',
			},
			ef,
			vf:push_button {
				title 		= LOC '$$$/LR2/PhotoFrames/Config/Select=Select',
				action		= function (button)
					local path = LrDialogs.runOpenPanel {
						title 	= LOC '$$$/LR2/PhotoFrames/Config/PathToImageMagick=Path to ImageMagick application:',
						prompt 	= LOC '$$$/LR2/PhotoFrames/Config/Select=Select',
						canChooseFiles 			= false,
						canChooseDirectories	= true,
						canCreateDirectories	= false,
						allowsMultipleSelection = false,
					}
					if path ~= nil then 
						ef.value = path[1]
					end
				end,
			},
		},
		vf:separator {
			fill_horizontal = 1,
		},
		vf:row{
			vf:static_text {
				title 		= LOC '$$$/LR2/PhotoFrames/Config/Copyright=LR2/PhotoFrames version 1.0.0 ^C Andriy Doroshchuk'
			},
		},
	}
	
end
--------------------------------------------------------------------------------

return LR2ConfigSection

